# vim: ts=4:sw=4:syntax=perl
sub mm_form_add_report_populate {
my ($rep_name,$rep_filename,$rep_title,$rep_directory,$rep_host,$rep_displaytext,$rep_type,$rep_attributes,$rep_convert_type,$rep_convert_desc,$rep_convert_args,$rep_desc)=@_;

	$rep_name="" if $rep_name eq "?rep_name - not defined?";
	$rep_filename="" if $rep_filename eq "?rep_filename - not defined?";
	$rep_title="" if $rep_title eq "?rep_title - not defined?";
	$rep_directory="" if $rep_directory eq "?rep_directory - not defined?";
	$rep_host="" if $rep_host eq "?rep_host - not defined?";
	$rep_displaytext="" if $rep_displaytext eq "?rep_displaytext - not defined?";
	$rep_type="" if $rep_type eq "?rep_type - not defined?";
	$rep_attributes="" if $rep_attributes eq "?rep_attributes - not defined?";
	$rep_convert_type="" if $rep_convert_type eq "?rep_convert_type - not defined?";
	$rep_convert_desc="" if $rep_convert_desc eq "?rep_convert_desc - not defined?";
	$rep_convert_args="" if $rep_convert_args eq "?rep_convert_args - not defined?";
	$rep_desc="" if $rep_desc eq "?rep_desc - not defined?";
	my @TYPES=$::GRI_FRONTEND->get_supported_types_list();

	$rep_name=hex_to_string($rep_name);
	$rep_filename=hex_to_string($rep_filename);
	$rep_title=hex_to_string($rep_title);
	$rep_directory=hex_to_string($rep_directory);
	$rep_host=hex_to_string($rep_host);
	$rep_displaytext=hex_to_string($rep_displaytext);
	$rep_type=hex_to_string($rep_type);
	$rep_attributes=hex_to_string($rep_attributes);
	$rep_convert_type=hex_to_string($rep_convert_type);
	$rep_convert_desc=hex_to_string($rep_convert_desc);
	$rep_convert_args=hex_to_string($rep_convert_args);
	$rep_desc=hex_to_string($rep_desc);
my $s="
    <tr class=gri_headerrow>
      <td colspan=3 align=left>New Report Details</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell colspan=3>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Title:</td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_title\" NAME=\"title\" SIZE=\"60\" MAXLENGTH=\"120\" TITLE=\"This is the text that will appear in the list of reports in a portal display\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Description:</td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <TEXTAREA NAME=\"desc\" COLS=\"80\" ROWS=\"5\" TITLE=\"A description of what data the report contains.\">$rep_desc</TEXTAREA>
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Host:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_host\" NAME=\"host\" SIZE=\"60\" MAXLENGTH=\"60\" TITLE=\"The machine name where the report is generated.\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Directory:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_directory\" NAME=\"directory\" SIZE=\"60\" MAXLENGTH=\"240\" TITLE=\"The directory where the reports exist on the specified machine.\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Report Name:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_name\" NAME=\"name\" SIZE=\"60\" MAXLENGTH=\"120\" TITLE=\"This is the name of the generated report. The date portion of the report name should be replaced with the appropriate % values shown to the right.\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>File Name:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_filename\" NAME=\"filename\" SIZE=\"60\" MAXLENGTH=\"120\" TITLE=\"The name to use to represent the report details. This should end in xml and ideally not include spaces.\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Display Text:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_displaytext\" NAME=\"displaytext\" SIZE=\"60\" MAXLENGTH=\"80\" TITLE=\"Enter a value here to show for the report rather than just a DD.MM.YYYY date. The % values to the left can be used.\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr>
      <td align=left><font class=stdtextlarge>Dynamic Conversion Type:</font></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td align=left>
	<SELECT NAME=\"convert_type\">\n";
	for my $ctype ("Not Required",@TYPES) {
		my @I=$::GRI_FRONTEND->get_type_info($ctype);
		my $ct=$ctype;
		if(defined($I[0])) {
			$ct.="&nbsp;&nbsp;&nbsp;\[$I[0]\]";
		}
		if($rep_convert_type eq "$ctype") {
			$s.="<OPTION value=\"$ctype\" selected=\"selected\">$ct</OPTION>\n";
		} else {
			$s.="<OPTION value=\"$ctype\">$ct</OPTION>\n";
		}
	}
	$s.="</SELECT>
      </td>
    </tr>
    <tr>
      <td colspan=3 align=left><font class=stdtextsmall>&nbsp;</font></td>
    </tr>
    <tr>
      <td align=left><font class=stdtextlarge>Dynamic Conversion Description:</font></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td align=left>
        <INPUT TYPE=\"text\" VALUE=\"$rep_convert_desc\" NAME=\"convert_desc\" SIZE=\"60\" MAXLENGTH=\"240\" style=\"font-family:Arial; font-size:11px; background-color: #FFFFFF; border:1px double #E0E0E0;\" TITLE=\"Enter short description of Dynamic type.\">
      </td>
    </tr>
    <tr>
      <td colspan=3 align=left><font class=stdtextsmall>&nbsp;</font></td>
    </tr>
    <tr>
      <td align=left><font class=stdtextlarge>Dynamic Conversion Arguments:</font></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td align=left>
        <INPUT TYPE=\"text\" VALUE=\"$rep_convert_args\" NAME=\"convert_args\" SIZE=\"60\" MAXLENGTH=\"240\" style=\"font-family:Arial; font-size:11px; background-color: #FFFFFF; border:1px double #E0E0E0;\" TITLE=\"Enter short description of Dynamic type.\">
      </td>
    </tr>
    <tr>
      <td colspan=3 align=left><font class=stdtextsmall>&nbsp;</font></td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Attributes:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
        <INPUT TYPE=\"text\" VALUE=\"$rep_attributes\" NAME=\"attributes\" SIZE=\"60\" MAXLENGTH=\"240\" TITLE=\"Enter series of attributes that should be applied to the report.\">
      </td>
    </tr>
    <tr class=gri_row>
      <td colspan=3 class=gri_cell>&nbsp;</td>
    </tr>
    <tr class=gri_row>
      <td class=gri_cell><font class=stdtextlarge>Report Content:</font></td>
      <td class=gri_cell>&nbsp;&nbsp;&nbsp;</td>
      <td class=gri_cell>
	<SELECT TITLE=\"The type of content in the file. This is irrespective of the actual name of the file/report.\" NAME=\"type\">\n";
	for my $ctype (@TYPES) {
		my @I=$::GRI_FRONTEND->get_type_info($ctype);
		my $ct=$ctype;
		if(defined($I[0])) {
			$ct.="&nbsp;&nbsp;&nbsp;\[$I[0]\]";
		}
		if($rep_type eq "$ctype") {
			$s.="<OPTION value=\"$ctype\" selected=\"selected\">$ct</OPTION>\n";
		} else {
			$s.="<OPTION value=\"$ctype\">$ct</OPTION>\n";
		}
	}
	$s.="</SELECT>
      </td>
    </tr>\n";
	return $s;
}

1;

